package com.DateTest;

import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main02
{
    public static void main(String[] args)
    {
        List<Student> list = new ArrayList<>();
        list.add(new Student("张三","语文",60));
        list.add(new Student("张三","数学",70));
        list.add(new Student("李四","语文",65));
        list.add(new Student("李四","数学",75));
        Student result = null;
        String name = null;
        int total = 0;
        for(Student stu : list){
            if(!stu.name.equals(name)){
                result = new Student();
                total = 0;
            }
            total = total + stu.score;
            result.total = total;
            name = stu.name;
        }
        System.out.println(result.total);
    }
}
class Student{
    public String name;
    public String course;
    public int score;
    public int total;

    public Student()
    {
    }

    public Student(String name, String course, int score)
    {
        this.name = name;
        this.course = course;
        this.score = score;
    }
}
